#include "ConvertSignal2SomeIP.h"
#include "someip/someip_signals.h"
#include "someip/someip_structs.h"
#include <string.h>

namespace ecarx::transfer::someip{

    std::shared_ptr<vsomeip::message> convertSignal2SomeipMessage(const Signal& signal){
        std::shared_ptr<vsomeip::message> request=vsomeip::runtime::get()->create_request(true);
        request->set_service(ADCU_HMI_SERVICE_ID);
        request->set_instance(ADCU_HMI_INSTANCE_ID);
        std::shared_ptr<vsomeip::payload> payload = vsomeip::runtime::get()->create_payload();
        switch(signal.signalId){

            case static_cast<int32_t>(SOMEIPTX::SettingDrivingInfoInfSetterId):{
                request->set_method(SettingDrivingInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingAEBInfoInfSetterId):{
                request->set_method(SettingAEBInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingLKAInfoInfSetterId):{
                request->set_method(SettingLKAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingFCTAInfoInfSetterId):{
                request->set_method(SettingFCTAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingRCTAInfoInfSetterId):{
                
                request->set_method(SettingRCTAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingDOWInfoInfSetterId):{
                
                request->set_method(SettingDOWInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingBSDInfoInfSetterId):{
                request->set_method(SettingBSDInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingTSIInfoInfSetterId):{
                request->set_method(SettingTSIInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingSRVInfoInfSetterId):{
                
                request->set_method(SettingSRVInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingEMAInfoInfSetterId):{
                
                request->set_method(SettingEMAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingTLAInfoInfSetterId):{
                request->set_method(SettingTLAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingCMSRInfoInfSetterId):{
                
                request->set_method(SettingCMSRInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingVoiceWarningInfoInfSetterId):{
                
                request->set_method(SettingVoiceWarningInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingAPAInfoInfSetterId):{
                
                request->set_method(SettingAPAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingRPAInfoInfSetterId):{
                request->set_method(SettingRPAInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingLPInfoInfSetterId):{
                
                request->set_method(SettingLPInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SelectedSlotIdInfSetterId):{
                
                request->set_method(SelectedSlotIdInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint32_t);
                uint8_t buffer[len]{};
                uint32_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SpeedLimitTriggerInfMethodId):{
                
                request->set_method(SpeedLimitTriggerInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::NavExitTriggerInfMethodId):{
                
                request->set_method(NavExitTriggerInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::NzpStateTriggerInfMethodId):{
                
                request->set_method(NzpStateTriggerInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::CustomParkingInfMethodId):{
                request->set_method(CustomParkingInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::NavigationInfoInfMethodId):{
                request->set_method(NavigationInfoInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::AlignedSpeedSettingInfSetterId):{
                
                request->set_method(AlignedSpeedSettingInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::PebSwitchSettingInfSetterId):{
                
                request->set_method(PebSwitchSettingInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::OnlineCalibTriggerInfMethodId):{
                request->set_method(OnlineCalibTriggerInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::LaneFunctionSetterId):{
                request->set_method(LaneFunctionSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::AbsoluteLocalizationInfSetterId):{
                request->set_method(AbsoluteLocalizationInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::DHUInquireIssueLogInfMethodId):{
                request->set_method(DHUInquireIssueLogInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingInitializationInfMethodId):{
                request->set_method(SettingInitializationInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingSGWInfoInfSetterId):{
                
                request->set_method(SettingSGWInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingCheckReqMethodId):{
                request->set_method(SettingCheckReqMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::NavigationStsInfMethodId):{
                
                request->set_method(NavigationStsInfMethod);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(int8_t);
                uint8_t buffer[len]{};
                int8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::APAnobtntriSwitchInfSetterId):{
                
                request->set_method(APAnobtntriSwitchInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingRCTBInfoInfSetterId):{
                
                request->set_method(SettingRCTBInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::AccfushSwitchTypeSetterId):{
                
                request->set_method(AccfushSwitchTypeSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::DispTSIInfoForLgtCtrlSeNSetterId):{
                
                request->set_method(DispTSIInfoForLgtCtrlSeNSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::APAparkinfoInfSetterId):{
                request->set_method(APAparkinfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(false);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::BigdataSpdLimSwitchInfSetterId):{
                
                request->set_method(BigdataSpdLimSwitchInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(uint8_t);
                uint8_t buffer[len]{};
                uint8_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingAEBFCWInfoInfSetterId):{
                request->set_method(SettingAEBFCWInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                payload->set_data(signal.value.bytes);
                break;
            }
            case static_cast<int32_t>(SOMEIPTX::SettingRCTABInfoInfSetterId):{
                
                request->set_method(SettingRCTABInfoInfSetter);
                request->set_message_type(vsomeip::message_type_e::MT_REQUEST_NO_RETURN);
                request->set_reliable(true);
                constexpr uint32_t len=sizeof(int32_t);
                uint8_t buffer[len]{};
                int32_t value=(int32_t)signal.value.int32Values[0];
                memcpy(buffer,&value,len);
                payload->set_data(buffer,len);
                break;
            }
        }
        request->set_payload(payload);
        return request;
    }
}
